import java.util.*;
import java.math.*;

class PhGA_Interface
{
	PhGA_Interface phga_interface;

	private native void create();

	//setting options
	private native void setPopulation(int pop);
	private native void setFactor(float factor);
	private native void setProblemSize(int size);
	private native void setTournamentSize(int size);
	private native void setSeed(int seed);
	
	private native float run();

	//fitness callback for the C code
	private float fitness(int[] chromosome, int size)
	{
		int sum=0;
		int i;
		for(i=0;i<size;i++)
		{
			sum+= chromosome[i];
		}

		return sum;
		//ASEvaluator.evaluateSubset(m_population[i].getChromosome());
	}

	public void createPhGA()
	{
		phga_interface= new PhGA_Interface();

		phga_interface.create();
		phga_interface.setPopulation(5000);
		phga_interface.setFactor(2);
		phga_interface.setProblemSize(40);
		phga_interface.setTournamentSize(16);
		//phga_interface.setSeed(44);
	
		float f= phga_interface.run();
		
		System.out.println("\nIN JAVA Result: " + f);

	}

	static 
	{
		System.loadLibrary("PhGA_Interface");
	}

	

}
